﻿@{
    var userProfile = Session["UserProfile"] as RbacLib.Models.UserProfile;
    var userMenu = RBAC.Web.Utilities.RbacUtil.SetUserMenu(userProfile);
    var roleMenu = RBAC.Web.Utilities.RbacUtil.SetRoleMenu(userProfile);
    var permissionMenu = RBAC.Web.Utilities.RbacUtil.SetPermissionMenu(userProfile);
    var functionMenu = RBAC.Web.Utilities.RbacUtil.SetFunctionMenu(userProfile);
    var domainMenu = RBAC.Web.Utilities.RbacUtil.SetDomainMenu(userProfile);
}

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title</title>
    <link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("~/Content/SideMenu.css")" rel="stylesheet" type="text/css" />
    <script src="@Url.Content("~/Scripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery-ui-1.8.20.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/modernizr-2.5.3.js")" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $('#cssmenu > ul > li > a').click(function () {
                $('#cssmenu li').removeClass('active');
                $(this).closest('li').addClass('active');
                var checkElement = $(this).next();
                if ((checkElement.is('ul')) && (checkElement.is(':visible'))) {
                    $(this).closest('li').removeClass('active');
                    checkElement.slideUp('normal');
                }
                if ((checkElement.is('ul')) && (!checkElement.is(':visible'))) {
                    $('#cssmenu ul ul:visible').slideUp('normal');
                    checkElement.slideDown('normal');
                }
                if ($(this).closest('li').find('ul').children().length == 0) {
                    return true;
                } else {
                    return false;
                }
            });

            $('#menu-icon').hover(function () {
                $('#display-menu').show();
            });

            $('#display-menu').live("mouseleave", function () {
                $(this).hide();
            });
        });
    </script>
    @RenderSection("Styles", false)
</head>

<body>
    <div id="wrap">
        <!--header -->
        <div id="header">

            <h1 id="logo-text"><a href="index.html" title="">RB<span>AC</span></a></h1>

            <div id="header-links">
                <p>
                    <a href="@Url.Content("~/Home")">Home</a> | 
			<a href="@Url.Content("~/Home")">Contact</a> | 
            <a href="@Url.Content("~/Home")">Site Map</a>|		
            	@Html.Partial("_LogOnPartial")
                </p>
            </div>

            <!--header ends-->
        </div>
        <!-- top navigation starts-->
        <div id="nav_top">
            <ul>
                <li><a href="@Url.Content("~/Home/Index")">Home</a></li>
                <li><a href="@Url.Content("~/User/ListUser")"" @userMenu>User</a></li>
                <li><a href="@Url.Content("~/Role/ListRole")"" @roleMenu>Role</a></li>
                <li><a href="@Url.Content("~/Permission/ListPermission")"" @permissionMenu>Permission</a></li>
                <li><a href="@Url.Content("~/Function/ListFunction")"" @functionMenu>Function</a></li>
                <li><a href="@Url.Content("~/Domain/ListDomain")"" @domainMenu>Domain</a></li>
                <li id="sub-menu">
                    <div id="menu-icon"></div>
                    <ul id="display-menu">
                        <li class="sub-menu-item"><a href="@Url.Content("~/RoleUser/ListRoleUser")">RoleUser</a></li>


                    </ul>
                </li>
            </ul>
        </div>
        <!-- navigation ends-->

        <div id="body">

            <!-- side bar starts-->
            <div id='cssmenu'>
                <ul>
                    <li class="active"><a href="@Url.Content("~/Home/Index")"><span>Home</span></a></li>
                    <li class="has-sub" @userMenu><a href='#'><span>User</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/User/ListUser")" ><span>User</span></a></li>
                        </ul>
                    </li>
                    <li class="has-sub" @roleMenu><a href='#'><span>Role</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/Role/ListRole")"><span>Role</span></a></li>
                        </ul>
                    </li>
                    <li class="has-sub" @permissionMenu><a href='#'><span>Permission</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/Permission/ListPermission")"><span>Permission</span></a></li>
                        </ul>
                    </li>
                    <li class="has-sub" @functionMenu><a href='#'><span>Function</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/Function/ListFunction")"><span>Function</span></a></li>
                        </ul>
                    </li>
                    <li class="has-sub" @domainMenu><a href='#'><span>Domain</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/Domain/ListDomain")"><span>Domain</span></a></li>
                        </ul>
                    </li>
                     <li class="has-sub"><a href='#'><span>RoleUser</span></a>
                        <ul>
                            <li class="last"><a href="@Url.Content("~/RoleUser/ListRoleUser")"><span>RoleUser</span></a></li>
                        </ul>
                    </li>
                    </li>
                </ul>
            </div>
            <!-- side bar ends-->

            <!-- content-wrap starts -->
            <div id="content-wrap">
                <div id="main">
                    @RenderBody()
                </div>
            </div>
        </div>
        <!-- footer starts -->
        <div id="footer-wrap">
            <div id="footer-bottom">
                <p>
                    &copy; 2013 <strong>Wichan Sutthiaksorn && Chayawooth Puyangtoom</strong> &nbsp;	
			    <a href="@Url.Content("~/Home")">Home</a>&nbsp;|&nbsp;
   		        <a href="@Url.Content("~/Home")">Sitemap</a>&nbsp;|&nbsp;
	   	        <a href="@Url.Content("~/Home")">RSS Feed</a>
                </p>
            </div>
        </div>
    </div>

</body>
</html>
